package zhh.tangbao.syslog.service.impl;

import org.springframework.stereotype.Service;
import zhh.tangbao.syslog.dao.SystemLogDao;
import zhh.tangbao.syslog.dto.SystemLogDto;
import zhh.tangbao.syslog.entity.SystemLog;
import zhh.tangbao.syslog.service.SystemLogService;
import zhh.tangbao.syslog.vo.SystemLogPageVo;
import zhh.tangbao.system.entity.PagerEntity;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 * @author 粥灰灰
 * @created 2022/10/1
 * @version 1.0
 * @Description 描述
 */

@Service
public class SystemLogServiceImpl implements SystemLogService {

    @Resource
    private SystemLogDao systemLogDao;

    @Override
    public int insertSystemLog(SystemLog systemLog) {
        return systemLogDao.insertSystemLog(systemLog);
    }

    @Override
    public PagerEntity<SystemLogPageVo> page(PagerEntity<SystemLogPageVo> pager, SystemLogDto dto) {
        List<SystemLogPageVo> result = systemLogDao.page(pager, dto);
        long count = systemLogDao.count(dto);
        pager.setTotalNum(count);
        pager.setData(result);
        return pager;
    }

    @Override
    public Set<String> modules() {
        return systemLogDao.modules();
    }
}
